{%  extends 'index.html' %}
{% load stu_tags %}
{% block page-content %}

<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">我的课程</div>
  <div class="panel-body">
     <table class="table table-striped table-responsive">
      <thead>
        <tr>
            <th>课程名称</th>
            <th>班级</th>
            <th>开课日期</th>
            <th>结业日期</th>
            <th>课程进度</th>
            <th>我的成绩</th>
            <th>作业管理</th>
        </tr>
      </thead>
      <tbody>
        {% for enroll_obj  in request.user.stu_account.enrollment_set.all %}
            <tr>
                <td>{{ enroll_obj.enrolled_class.course }}</td>
                <td>s{{ enroll_obj.enrolled_class.semester }}</td>
                <td>{{ enroll_obj.enrolled_class.start_date }}</td>
                <td>{{ enroll_obj.enrolled_class.end_date }}</td>
                <td>已上{{ enroll_obj.enrolled_class.courserecord_set.all.count }}节</td>
                <td>{% get_score enroll_obj request.user.stu_account as score_data %}
                    {{ score_data.score__sum }}
                </td>
                <td><a href="{% url 'studyrecords' enroll_obj.id %}">作业管理</a></td>
            </tr>
        {% endfor %}

      </tbody>
    </table>


  </div>
  <!-- Table -->
</div>
{% endblock %}